package com.markus.basic.设计模式.适配器模式;

/**
 * Author:markusZhang
 * Date:Create in 2020/8/30 11:52
 * todo:
 */
public class MediaAdapter implements MediaPlayer{
    AdvanceMediaPlayer advanceMediaPlayer;
    @Override
    public void play(String audioType, String fileName) {
        if ("vlc".equalsIgnoreCase(audioType)){
            advanceMediaPlayer.playVlc(fileName);
        }else if ("mp4".equalsIgnoreCase(audioType)){
            advanceMediaPlayer.playMp4(fileName);
        }
    }
    public MediaAdapter(String audioType){
        if ("vlc".equalsIgnoreCase(audioType)){
            advanceMediaPlayer = new VlcPlayer();
        }else if ("mp4".equalsIgnoreCase(audioType)){
            advanceMediaPlayer = new Mp4Player();
        }
    }
}
